From e9dc4ac86f9dbd59147963d08ec8447bba3ed0bb Mon Sep 17 00:00:00 2001
From: Daniel Kucera <daniel.kucera@gmail.com>
Date: Mon, 23 Oct 2017 15:29:17 +0200
Subject: [PATCH] demux_lavf: return AVERROR_EOF on file end

Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
Signed-off-by: wm4 <wm4@nowhere>

Uses different style and different logic from original PR.
---
 demux/demux_lavf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index c11f7739e1..11fa1c59b6 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -242,7 +242,7 @@ static int mp_read(void *opaque, uint8_t *buf, int size)
 
     MP_TRACE(demuxer, "%d=mp_read(%p, %p, %d), pos: %"PRId64", eof:%d\n",
              ret, stream, buf, size, stream_tell(stream), stream->eof);
-    return ret;
+    return ret ? ret : AVERROR_EOF;
 }
 
 static int64_t mp_seek(void *opaque, int64_t pos, int whence)
